<template>
  <div v-if="value">
    <div class="mask"></div>
    <div class="popup-wrapper">
      <div class="popup">
        <div class="popup__header">
          <span>{{ title }}</span>
          <img src="./icon-close.svg" class="btn-close" @click="$emit('input', false)" alt="">
        </div>
        <div class="popup__body">
          <slot></slot>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: Boolean,
    title: {
      type: String,
      default: '活动规则'
    }
  }
};
</script>

<style scoped>
.popup-wrapper {
  z-index: 1000;
  position: fixed;
  width: 100%;
  top: 20%;
}

.popup {
  width: 343px;
  padding-bottom: 20px;
  margin: 0 auto;
  background: #fff;
}

.popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  line-height: 48px;
  padding: 0 24px;
  font-size: 18px;
  box-shadow: 0 1px 0 0 #e6e6e6;
}

.popup__body {
  overflow: auto;
  height: 300px;
  padding: 0 16px;
  padding-bottom: 10px;
  font-size: 14px;
  line-height: 22px;
  text-align: justify;
  -webkit-overflow-scrolling: touch;
}

.btn-close {
  margin-right: -8px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
</style>
